using System;
using System.ComponentModel;
using System.Transactions;
using System.Data;

using SIS.ENT;
using SIS.DAL;


namespace SIS.BLL
{

    /// <summary>
    /// The StudentRegisterationTableManager class is responsible for managing BO.StudentRegisterationTable objects in the system.
    /// </summary>
    [DataObjectAttribute()]
    public class StudentRegisterationTableManager
    {

        #region "Public Methods"

        /// <summary>
        /// Gets a list with all StudentRegisterationTable objects in the database.
        /// </summary>
        /// <returns>A list with all StudentRegisterationTable from the database when the database contains any, or null otherwise.</returns>
        [DataObjectMethod(DataObjectMethodType.Select, true)]
        public static StudentRegisterationTableList GetList()
        {
            return StudentRegisterationTableDB.GetList();
        }

        public static DataTable GetListByTimeTableKey(int SchoolKey, int LocationKey, int ClassRoomKey, int StandardLevelKey, int EducationPeriodKey, int TimeTableKey)
        {
            return StudentRegisterationTableDB.GetListByTimeTableKey(SchoolKey, LocationKey, ClassRoomKey, StandardLevelKey, EducationPeriodKey, TimeTableKey);
        }

        /// <summary>
        /// Gets a single StudentRegisterationTable from the database without its data.
        /// </summary>
        /// <param name="sRID">The SRID of the StudentRegisterationTable in the database.</param>
        /// <returns>A StudentRegisterationTable object when the SRID exists in the database, or <see langword="null"/> otherwise.</returns>
        [DataObjectMethod(DataObjectMethodType.Select, false)]
        public static StudentRegisterationTable GetItem(int sRID)
        {
            return GetItem(sRID, false);
        }

        /// <summary>
        /// Gets a single StudentRegisterationTable from the database without its data.
        /// </summary>
        /// <param name="SchoolKey">The SRID of the StudentRegisterationTable in the database.</param>
        /// <param name="UserAccountKey">The UserAccountKey of the StudentRegisterationTable in the database.</param>
        /// <param name="StudentProfileKey">The StudentProfileKey of the StudentRegisterationTable in the database.</param>
        /// <param name="EducationPeriodKey">The EducationPeriodKey of the StudentRegisterationTable in the database.</param>
        /// <param name="StandardLevelKey">The StandardLevelKey of the StudentRegisterationTable in the database.</param>
        /// <param name="ClassRoomKey">The ClassRoomKey of the StudentRegisterationTable in the database.</param>
        /// <returns>A StudentRegisterationTable object when the SRID exists in the database, or <see langword="null"/> otherwise.</returns>
        [DataObjectMethod(DataObjectMethodType.Select, false)]
        public static StudentRegisterationTable GetItem(int SchoolKey, int UserAccountKey, int StudentProfileKey, int EducationPeriodKey, int StandardLevelKey, int ClassRoomKey)
        {
            StudentRegisterationTable myStudentRegisterationTable = StudentRegisterationTableDB.GetItem(SchoolKey, UserAccountKey, StudentProfileKey, EducationPeriodKey, StandardLevelKey, ClassRoomKey);
            return myStudentRegisterationTable;
            
        }
        /// <summary>
        /// Gets a single StudentRegisterationTable from the database.
        /// </summary>
        /// <param name="sRID">The SRID of the StudentRegisterationTable in the database.</param>
        /// <param name="getStudentRegisterationTableRecords">Determines whether to load all associated StudentRegisterationTable records as well.</param>
        /// <returns>
        /// A StudentRegisterationTable object when the SRID exists in the database, or <see langword="null"/> otherwise.
        /// </returns>
        [DataObjectMethod(DataObjectMethodType.Select, false)]
        public static StudentRegisterationTable GetItem(int sRID, bool getStudentRegisterationTableRecords)
        {
            StudentRegisterationTable myStudentRegisterationTable = StudentRegisterationTableDB.GetItem(sRID);
            return myStudentRegisterationTable;
        }

        /// <summary>
        /// Saves a StudentRegisterationTable in the database.
        /// </summary>
        /// <param name="myStudentRegisterationTable">The StudentRegisterationTable instance to save.</param>
        /// <returns>The new SRID if the StudentRegisterationTable is new in the database or the existing SRID when an item was updated.</returns>
        [DataObjectMethod(DataObjectMethodType.Update, true)]
        public static int Save(StudentRegisterationTable myStudentRegisterationTable)
        {
            using (TransactionScope myTransactionScope = new TransactionScope())
            {
                int studentRegisterationTableSRID = StudentRegisterationTableDB.Save(myStudentRegisterationTable);

                //  Assign the StudentRegisterationTable its new (or existing SRID).
                myStudentRegisterationTable.SRID = studentRegisterationTableSRID;

                myTransactionScope.Complete();

                return studentRegisterationTableSRID;
            }
        }

        /// <summary>
        /// Deletes a StudentRegisterationTable from the database.
        /// </summary>
        /// <param name="myStudentRegisterationTable">The StudentRegisterationTable instance to delete.</param>
        /// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
        [DataObjectMethod(DataObjectMethodType.Delete, true)]
        public static bool Delete(StudentRegisterationTable myStudentRegisterationTable)
        {
            return StudentRegisterationTableDB.Delete(myStudentRegisterationTable.SRID);
        }

        #endregion

    }

}
